import java.util.Iterator;

/**
 * @projectName: com.xiayuanxing.designPattern
 * @className: ComputerCollege
 * @author: xiayuanxing
 * @description: TODO
 * @date: 2022/1/7 11:23
 * @version: 1.0
 */
public class ComputerCollege implements College{

    Department[] departments;

    /** 保存当前数组的对象个数 */
    int numOfDepartment = 0;

    public ComputerCollege() {
        departments = new Department[5];
        addDepartment("java专业","java专业");
        addDepartment("Python专业","Python专业");
        addDepartment("PHP专业","PHP专业");
    }

    public String getName() {
        return "计算机学院";
    }

    public void addDepartment(String name, String desc) {
        Department department = new Department(name, desc);
        departments[numOfDepartment] = department;
        numOfDepartment +=1;

    }

    public Iterator createIterator() {
        return new ComputerCollegeIterator(departments);
    }
}
